
package routing;

/**
 *
 * @author Paweł
 */
public class UsernameKey implements de.uniba.wiai.lspi.chord.service.Key {
    private String username;

    /**
     * Creates key.
     * @param username - username to search
     */
    public UsernameKey(String username) {
        this.username = username;
    }

    public byte[] getBytes() {
        return this.username.getBytes();
    }

    @Override
    public int hashCode() {
        return this.username.hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof UsernameKey) {
            return ((UsernameKey) o).username.equals(this.username);
        }
        return false;
    }

    @Override
    public String toString() {
        return username;
    }

}
